<script>
if (window.testRunner) {
  testRunner.dumpAsText();
  testRunner.setPopupBlockingEnabled(false);
  testRunner.waitUntilDone();
}

// This is a test that replaceState called on an inner frame does not modify
// the history state of the top frame.  The test asserts that the inner frame
// remains the inner frame and is not promoted to become the top frame during
// history traversal (on navigating back).

var testWin;

function notifyDone(result) {
  testWin.close();
  delete testWin;

  document.body.innerText = result;

  if (window.testRunner)
    testRunner.notifyDone();
}

function windowLoaded() {
  // Allow load processing to complete before we start navigating again, so
  // that navigating to navigate-back.html creates a new history item.
  setTimeout(function() {
    testWin.frames[0].history.replaceState(null, null);
    testWin.location = "resources/navigate-back.html";
  }, 0);
}

onload = function() {
  testWin = open("resources/replacestate-in-iframe-window.html");
}
</script>
<body>PENDING</body>
